const response = async (ctx, next, ) => {
  ctx.success = ({data, msg, total, success}) => {
    ctx.body = {code: 200, data, msg, total, success}
  }

  ctx.fail = ({msg}) => {
    ctx.body = {code: 400, msg}
  }
  await next()
}

module.exports = response